﻿using Microsoft.EntityFrameworkCore;

namespace Devonline.AspNetCore;

/// <summary>
/// 同时处理附加信息和附件的类服务
/// 每个 TEntitySet 类型中的 TAdditional 类型的附加信息认为有且仅有一个
/// </summary>
/// <typeparam name="TDbContext">数据库上下文</typeparam>
/// <typeparam name="TEntitySet">业务数据类型</typeparam>
/// <typeparam name="TAdditional">附加信息数据类型</typeparam>
/// <typeparam name="TAttachment">附件</typeparam>
/// <typeparam name="TKey">键类型</typeparam>
public interface IDataWithAdditionalAndAttachmentService<TDbContext, TEntitySet, TAdditional, TAttachment, TKey> :
    IDataService<TDbContext, TEntitySet, TKey>
    where TDbContext : DbContext
    where TEntitySet : class, IEntitySet<TKey>
    where TAdditional : class, IAdditional<TKey>
    where TAttachment : class, IAttachment<TKey>, new()
    where TKey : IConvertible
{ }

/// <summary>
/// 同时处理附加信息和附件的类服务
/// 字符串作为主键的默认实现
/// 每个 TEntitySet 类型中的 TAdditional 类型的附加信息认为有且仅有一个
/// </summary>
/// <typeparam name="TDbContext">数据库上下文</typeparam>
/// <typeparam name="TEntitySet">业务数据类型</typeparam>
/// <typeparam name="TAdditional">附加信息数据类型</typeparam>
public interface IDataWithAdditionalAndAttachmentService<TDbContext, TEntitySet, TAdditional> :
    IDataWithAdditionalAndAttachmentService<TDbContext, TEntitySet, TAdditional, Attachment, string>
    where TDbContext : DbContext
    where TEntitySet : class, IEntitySet<string>
    where TAdditional : class, IAdditional<string>
{ }